Machine learning can be used to classify images. For example, a neural network can be used to classify an image based on visual features of the image. Neural networks are machine learning models that employ one or more layers to generate an output, e.g., a classification of an image, for a received input, e.g., features of an image. Some neural networks include one or more hidden layers in addition to an outer layer. The output of each hidden layer is used as input to the next layer in the network, i.e., the next hidden layer or the output layer of the network. Each layer of the network generates an output from a received input in accordance with current values of a respective set of parameters.
Some neural networks include one or more convolutional neural network layers. Each convolutional neural network layer has an associated set of kernels. Kernels can be represented as a matrix structure of weight inputs. Each convolutional layer uses the kernels to process inputs to the layer. A set of inputs to the layer can also be represented as a matrix structure.
A neural network is configured to receive images of a particular shape. However, some images that are to be classified using the neural network may have a different shape than the configured shape.